package com.fita.wechat.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.demo2do.core.persistence.GenericDaoSupport;
import com.demo2do.core.persistence.annotation.Dao;
import com.fita.entity.set.Set;
import com.fita.entity.set.SetStatus;
import com.fita.wechat.dao.SetDao;
import com.fita.wechat.service.SetService;

/**
 * 
 * @author mohanlan
 *
 */
@Service("setService")
public class SetServiceImpl implements SetService {
    
    @Dao
    private SetDao setDao;
    
    @Autowired
    private GenericDaoSupport genericDaoSupport;

    /*
     * (non-Javadoc)
     * @see com.fita.wechat.service.SetService#listAvaliableSets()
     */
    public List<Set> listAvaliableSets() {
        return setDao.list(SetStatus.OPEN);
    }
    
    /*
     * (non-Javadoc)
     * @see com.fita.wechat.service.SetService#load(java.lang.Long)
     */
    public Set load(Long setId) {
        return genericDaoSupport.load(Set.class, setId);
    }
    
    /*
     * (non-Javadoc)
     * @see com.fita.wechat.service.SetService#load(java.lang.String)
     */
    public Set load(String code) {
        return setDao.load(code);
    }

}
